# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html

import scrapy
from scrapy.contrib.pipeline.images import ImagesPipeline
from scrapy.exceptions import DropItem
class ZmsImagesPipeline(ImagesPipeline):
    def get_media_requests(self, item, info):
            yield scrapy.Request(item["picUrl"])

    def item_completed(self, results, item, info):
        item['image_paths'] = "%s.%s%s" % (item["index"],item["title"],item["ext"])
        return item